package entity

type PS1Config struct {
	ScriptName  string   `yaml:"script_name"`
	ShowHelpUrl bool     `yaml:"show_help_url"`
	Args        []string `yaml:"args"`
}

func (r *PS1Config) AllEmpty() bool {
	return r.ScriptName == "" && len(r.Args) == 0
}

func (r *PS1Config) Compare(obj FieldInterface) FieldInterface {
	localConfig, ok := obj.(*PS1Config)
	if !ok || localConfig == nil || localConfig.AllEmpty() {
		return r
	}

	if localConfig.ScriptName == "" {
		localConfig.ScriptName = r.ScriptName
	}
	if len(localConfig.Args) == 0 {
		localConfig.Args = r.Args
	}
	return localConfig
}
